< previous page page_578 next page >

Page 578
Figure 26.4 shows the form with the command buttons in place.
0578-01.jpg
Figure 26.4
Add command buttons to enable the
users to navigate through the recordset.
3. Add this code to the Click event procedure of cmdFirst:
rsTitles.MoveFirst
Call ShowFields
4. Add this code to the Click event procedure of cmdPrevious:
rsTitles.MovePrevious
Call ShowFields
5. Add this code to the Click event procedure of cmdNext:
rsTitles.MoveNext
Call ShowFields
6. Add this code to the Click event procedure of cmdLast:
rsTitles.MoveLast
Call ShowFields
When you run the project, you should be able to use the four command buttons to navigate the recordset.
The last Move method, Move n, lets you move more than one record from the current position. The value of n is the number of records to move in the recordset. This value can be either positive or negative to indicate movement either forward or backward in the recordset. The following line of code shows the use of this method to move two records forward from the current record:
rsTitles.Move 2
Using the Bookmark Property
Being able to return to a specific record after the record pointer moves or new records are added is often desirable. You can do so by using the Bookmark property of the recordset. The bookmark is a system-assigned string variable that is correlated to the record and is unique for each record in a recordset. To use a bookmark, simply create a string variable to "remember" the bookmark and set that variable to the value of the recordset's Bookmark property before the record pointer moves. When you need to move the record pointer back to that record, set the recordset's Bookmark property to the value of your bookmark variable. The following section demonstrates this technique while using the Find methods.

 
< previous page page_578 next page >